package model

import (
	"awesomeProject2/global"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Password string `json:"password"  gorm:"type:varchar(50);"`
	IsAdmin  bool   `json:"is_admin" gorm:"type:tinyint"`
	Username string `json:"username" gorm:"type:varchar(50)"`
}

func GetUserByDynamicQuery(query *User) (err error, user User) {
	err = global.GVA_DB.Where(query).First(&user).Error
	return err, user
}
